home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
rename11.zip
/
RENAMER.DOC
< prev
next >
Wrap
Text File
|
1991-08-31
|
25KB
|
828 lines
ReNamer
When software names must be changed
Version 1.1
August, 1991 Release
ConVal Software, Inc.
_______
____|__ | (R)
--| | |-------------------
| ____|__ | Association of
| | |_| Shareware
|__| o | Professionals
-----| | |---------------------
|___|___| MEMBER
Copyright 1991 ConVal Software, Inc.
All rights reserved.
ConVal Software, Inc.
11607 E. Butter Creek Road
Moorpark, CA 93021
Sales and
technical support: Monday - Friday
(805) 529-6847 9 AM - 6 PM Pacific Time
Leave a message and I'll contact you the
same or next business day.
7 PM - 10 PM Pacific Time
To speak to me directly.
CompuServe 72330,1621
This program is produced by a member of the Association of
Shareware Professionals (ASP). ASP wants to make sure that the
shareware principle works for you. If you are unable to resolve
a shareware-related problem with an ASP member by contacting the
member directly, ASP may be able to help. The ASP Ombudsman can
help you resolve a dispute or problem with an ASP member, but
does not provide technical support for members' products.
Please write to the ASP Ombudsman at:
ASP Ombudsman
545 Grover Road
Muskegon, MI 49442-9427
U.S.A.
or send a CompuServe message via CompuServe MAIL to ASP Ombudsman
70007,3536.
The ombudsman may be contacted by FAX by sending to the ASP FAX
number: (616) 788-2765. In communication with the ombudsman please
include a telephone number and/or FAX if available.
TABLE OF CONTENTS
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . 4
FEATURES OF ReNamer . . . . . . . . . . . . . . . . . . . . . 6
INSTALLATION . . . . . . . . . . . . . . . . . . . . . . . . 7
SPECIFYING THE FILES TO BE EXAMINED . . . . . . . . . . . . . 8
SPECIFYING THE NAMING TRANSFORM . . . . . . . . . . . . . . . 10
GETTING STARTED . . . . . . . . . . . . . . . . . . . . . . . 11
NOTES AND RESTRICTIONS . . . . . . . . . . . . . . . . . . . 13
ReNamer 1.1 Copyright ConVal Software, Inc. 1991 Page 3
INTRODUCTION
Having now been a software developer and consultant for many
years, I've built a number of support tools for myself. I am
continuing to generalize and formalize those tools, making them
available for other programmers and consultants like you.
ReNamer is the second of these and I think you'll find it can
give you a competitive edge in your work.
The idea for this product came when working for a client in a
large MVS environment. The client was developing software for a
customer. The customer had provided some other software for my
client to use in-house.
I was asked to modify the member names of the provided source
code to match my client's naming conventions so that it could be
maintained in their standard software library control system.
(They used IBM's Library Management Facility and partitioned
datasets.)
So I needed to change names to prevent collision with my client's
existing application member names. There were FORTRAN, COBOL,
PL/I, CLIST and SQL components, as well as documentation files.
As I began the project, using tools that were available, some
challenging renaming tasks surfaced. If you've ever taken on a
renaming assignment manually you're probably aware of the issues.
For those who have not yet had such an opportunity, here are a
few:
The filename "BONUS.COB" probably contains a COBOL
subroutine named "BONUS". Other files probably contain
CALL 'BONUS' USING
references to the subroutine and also documentation about
the "BONUS" subroutine. So we will want to change internal
references as well as filenames.
If the filename "ART" is to be changed to XXXART then an
occurrence of PART-TYPE in a COBOL file could become
PXXXART-TYPE. This change is probably not desired.
If the filename "ADDIT" is to be changed to XXXADDIT then
START Addit in a SQL file could be missed because of the
case mismatch.
If the lengths of the source-text and replacement-text are
different, then text could be shifted between the "free-
form" area of COBOL or FORTRAN and the sequence (or
identification) area in columns 73-80.
After completing this project I set out to develop a software
ReNamer 1.1 Copyright ConVal Software, Inc. 1991 Page 4
tool to help others do this kind of job easily. ReNamer is the
result.
Note that porting your application from one platform to another
where external names can't be as long is another excellent use
for ReNamer.
You may also wish to use it to allow you to change your internal
naming conventions to, say, the Hungarian notation, coined by
Charles Simonyi of Microsoft. The notation requires a lower case
prefix that describes data type, followed by a variable name
whose first letter is capitalized. Some prefix examples are:
b - boolean (0 or 1, usually an int)
c - character
i - int
l - long
p - pointer
For example,
iHeapStatus is an integer variable whose name is HeapStatus.
This convention is used widely by MS-Windows and OS/2
programmers. The ReNamer utility will enable you to readily
change your naming convention.
On mainframes where many applications share a production
environment like CICS and IMS, naming collisions must be avoided.
Use ReNamer on your product to make it conform to your potential
client's needs. It could give you a sale you'd miss otherwise!
ReNamer 1.1 Copyright ConVal Software, Inc. 1991 Page 5
FEATURES OF ReNamer
ReNamer reads a list of text files and makes a copy of each with
its symbols altered according to a symbol rename list. This
version has special processing logic for supporting the syntax of
the following file types:
FILE
EXTENSION CATEGORY
---- --------------------
.BAS BASIC
.BAT Batch Files
.C .H C source
.CPP .HPP C++ source
.COB COBOL
.FOR FORTRAN
.ASM Macro Assembler
.MAK Make files
.SQL .INP Oracle
.PAS Pascal
.PLI PL/I
.REX REXX
.TXT Text (ASCII)
.DOC Text (ASCII)
.PRG xBASE
All other types are processed as if they were ASCII text
files.
You will prepare a control file, called the file specification
list, containing a list of files to be processed. Or, you may use
a utility, CRE8FSL (see Page 8), to create a list of all files
on a directory which match one of the file types currently
supported by ReNamer.
You'll prepare a second control file, called the symbol rename
list, with each record containing an "old name" a "new name" and
a flag to tell whether the search for the old name is to be case
sensitive.
When you invoke the ReNamer program, you will specify a directory
for the copies of the files containing the transformed symbols to
be written. (Your files are not changed in place!)
ReNamer 1.1 Copyright ConVal Software, Inc. 1991 Page 6
INSTALLATION
ReNamer requires an IBM PC, XT, AT, PS/2 or compatible computer with
256K of RAM. Your CONFIG.SYS file must specify FILES=10 or more for
the program to run. In addition, version 2.0 or greater of PC-DOS or
MS-DOS is required.
ReNamer requires approximately 100K of computer memory to contain
the program's executable code. Additional memory is allocated as
required to contain the list of files and symbols being processed.
This data is allocated in conventional memory. ReNamer will acquire
as much conventional memory as is available to handle large
numbers of files and/or large numbers of symbols to be renamed.
ReNamer is not a Terminate and Stay Resident program, so the
memory it uses is only required when you are actually running the
program.
Installing ReNamer is very simple. If you have a hard disk, create a
RENAMER directory and copy all the files on the ReNamer diskette to
that directory. The ZIP file can be discarded - it is just used for
BBS distribution.
To install on a floppy system, copy all the files on the ReNamer
diskette except the ZIP file to a working diskette. Then keep the
ReNamer original disk for backup.
See the README.DOC file for instructions for running the demo.
After you are familiar with the product, you may save disk space by
removing all but the following files:
RENAMER.EXE the executable file for ReNamer
RENAMER.FSL an input file - File Specification List
RENAMER.SRL an input file - Symbol Rename List
CRE8FSL.EXE a utility to prepare a File
Specification List
ReNamer requires one command-line argument:
RENAMER /OUTDIR=path-name
where path-name tells ReNamer where to write the output files.
Note: The files being processed must not already exist in this
directory.
When ReNamer is started with no other command-line arguments, it
assumes its input control files (FSL and SRL) are in the current
directory and it creates its statistics output file (MSG) in the
current directory.
For other options, see Page 11.
ReNamer 1.1 Copyright ConVal Software, Inc. 1991 Page 7
SPECIFYING THE FILES TO BE EXAMINED
A File Specification List (FSL) file identifies to ReNamer the
files to be read. It is a text file which may be created with any
text editor. Each record must start in column one and contain
exactly three columns - Record format, Maximum record length, and
File specification.
Record format - F "Fixed length records" Each record
of the file is the same length.
V "Variable length records" The
length of the records may be
different.
Maximum record - a number For fixed length records this
length <= 256 is the actual length of each
input record in this file.
For variable length records
this is the maximum length to
be written for any given input
record after transforming
symbols.
File specification - A DOS file specification.
Example:
V 100 C:\SOURCE\MAINPGM.C
V 100 C:\SOURCE\SUBPGM1.C
V 100 C:\SOURCE\SUBPGM2.C
V 100 C:\SOURCE\INCLUDE\INFILE.H
V 120 D:\SAMPLES\DEMO01.TXT
F 80 C:\COBOL\TEST1.COB
F 80 C:\FORTRAN\MYPROG.FOR
F 80 C:\PLI\DOTHIS.PLI
List all files in the File Specification List to insure that the
renaming is complete.
To ease the effort in preparing this file, a utility called CRE8FSL
is provided for you. Given a directory, it will read will read all
files in that directory, writing each filename matching a file type
that ReNamer knows how to process. It produces its output to the
DOS standard output, so it can be redirected to a file.
ReNamer 1.1 Copyright ConVal Software, Inc. 1991 Page 8
Example 1: This causes CRE8FSL to create a list of all files
on the directory C:\SOURCE.
CRE8FSL C:\SOURCE > ReNamer.FSL
Example 2: This causes CRE8FSL to create a list of all files
on the C root directory.
CRE8FSL C: > ReNamer.FSL
Example 3: This causes CRE8FSL to create a list of all files
on three different directories.
CRE8FSL C:\BASELINE > ReNamer.FSL
CRE8FSL D:\CHANGES1 >> ReNamer.FSL
CRE8FSL D:\CHANGES2 >> ReNamer.FSL
ReNamer 1.1 Copyright ConVal Software, Inc. 1991 Page 9
SPECIFYING THE NAMING TRANSFORM
This input to ReNamer is a Symbol Rename List (SRL) file. It
contains the rules to be followed in changing "old symbols" to
"new symbols".
Use a text editor to create this file. Start each entry in column
one and place exactly three columns on each record - Case code,
Old symbol and New symbol.
Case code - I when your want ReNamer to look for the
Old symbol regardless of the case of
each letter. (both comparands are raised
to upper case before the comparison)
S when you want ReNamer to have an exact
match on the Old symbol before it will
replace it with New symbol.
Old symbol One to 31 characters. A valid symbol for the
language being parsed. For case code I, this
may be entered without regard to case. (It
doesn't matter how you enter this.) For case
code S, enter it exactly as you want it to be
for this symbol to be replaced by the New
symbol.
New symbol One to 31 characters. A valid symbol for the
language being parsed. The case of this entry
is important, since this will be used as-is
when making replacements.
Example: Change "calculate_distance" to "CALCDIST" regardless of
case. Change "Help_Routine" to "HelpRtn" but perform
case-sensitive matching. Change "RandomValue" to
"RNDVAL", performing case-sensitive matching.
I calculate_distance CALCDIST
S Help_Routine HelpRtn
S RandomValue RNDVAL
ReNamer 1.1 Copyright ConVal Software, Inc. 1991 Page 10
GETTING STARTED
Prior to running ReNamer, create the list of files to be examined
(see Page 8) and the symbol rename list (see Page 10). Remember
that the program won't run unless CONFIG.SYS contains FILES=10.
The usual way to start up ReNamer is to type
RENAMER /OUTDIR=???
filling in the destination directory and pressing Enter at the DOS
prompt. Note: The files being processed must not already exist in
this directory.
RENAMER ? Will cause ReNamer to display help
information.
However, the following parameters can be specified on the command
line to modify ReNamer's behavior during a particular run. The
general command line syntax for running ReNamer is:
RENAMER /OUTDIR=xxx [fsl srl msg]
where xxx is a path which identifies where to put the output
files after the renaming. Note: Files being processed must not
already exist in this directory.
fsl is a file specification for the input file containing
file specifications for each source to be
processed. If omitted, this defaults to
RENAMER.FSL.
srl is a file specification for the input file containing
the symbol rename list. If omitted, this defaults
to RENAMER.SRL.
msg is a file specification for the output file of
run statistics. If omitted, this defaults to
RENAMER.MSG.
Example 1: Take all the defaults.
RENAMER /OUTDIR=C:\TEMP
The two control files (RENAMER.FSL and RENAMER.SRL) must be
in the current directory. This will read file specifications
from RENAMER.FSL and will get the symbol rename list from
RENAMER.SRL. Messages will be output to RENAMER.MSG. The
copies of the renamed files will be generated to the C:\TEMP
directory. This directory must already exist and none of the
files to be generated must exist (as a safety precaution).
ReNamer 1.1 Copyright ConVal Software, Inc. 1991 Page 11
Example 2: Override the location and naming of the control and
message files.
RENAMER /OUTDIR=D:\NEWNAMES C:\FILESPEC.LST OLDNEW.CTL
MESSAGE.LST
Here files are produced to the D: drive in the NEWNAMES
directory and we've overridden ReNamer's standard file names
and location.
Although the above is shown as two separate lines, you would
type it all in at the DOS prompt and press enter once.
NOTE: All parameters are positional. So, to override the
last one, you must supply the defaults for all others. That
is, none may be omitted prior to the one you wish to
override.
ReNamer 1.1 Copyright ConVal Software, Inc. 1991 Page 12
NOTES AND RESTRICTIONS
1. COBOL, FORTRAN, and PL/I are assumed to be fixed length, 80
byte records.
2. Data in columns 1-7 and 73-80 of COB, 1-6 and 73-80 of FOR,
and 73-80 of PLI filetypes is copied as is. No symbol
translation is used for these ID, sequence and comment
columns.
3. If you get the message "Insufficient memory", try reducing
the scope of the processing. This may mean limiting the file
specification list (FSL) entries to only those files used by
your application and/or limiting the symbol rename lists
(SRL) entries and making multiple passes to rename all
symbols.
4. Only the first 31 characters of a symbol are retained.
5. Filenames and symbols must be consistent with the symbol
naming convention for each source file type.
So the restriction means that if the following is a fragment
from a .C file, a renaming would not be performed for lines
3 or 4 below, even though these are valid DOS file names.
This is because the names are not valid C symbols.
1. avg_value = get_avg ( list ); OK
2. fp = fopen ( "C:\\TEST.dat", "r" ); OK
3. fp = fopen ( "87tax.dat", "w" ); starts with
a digit
4. strcpy ( fspec, "A:$budget.trn" ); starts with $
6. If a filename to be processed is also a language
keyword you use (like extern.bat if you use C) then all
occurances of that symbol in will become uppercase in
all the C files processed. So exclude files like this
from ReNamer processing or rename them first.
7. The ReNamer demo creates a directory named TEMPZCVS on the disk
where you run the demo. So if you run the demo multiple times,
you'll get a message that the directory already exists after
the first time.
8. String literals may contain tokens of no more than 99
characters each.
9. Whenever a symbol is replaced by a longer symbol and there
are sufficient trailing blanks on a statement, then the
replacement will occur on the same statement. When no more
space is available on the current statement, a new statement
will be created. You will be notified of this by a message
that "statement number nnn had to be split". Since this
process duplicates the sequence number field of the original
statement, you may need to make manual changes in these cases.
ReNamer 1.1 Copyright ConVal Software, Inc. 1991 Page 13
10. In a single invocation of ReNamer the filenames in the
file specification list (FSL) must be unique. Thus
MYPGM.C and MYPGM.TXT cannot be processed in the same
run.
End of ReNamer Documentation.
ReNamer 1.1 Copyright ConVal Software, Inc. 1991 Page 14